<div class="layui-fluid" id="VIEW-index" lay-title="首页">
  <div class="nepadmin-pad-tb20">
    <h1 class="nepadmin-lead">重庆钰圳广越商贸有限公司</h1>
    <div class="nepadmin-ignore nepadmin-pad-tb10">
      <p>YZGY-OA 钰圳广越企业管理平台</p>
      <p id="index_sys_info"></p>
    </div>
  </div>
  <div class="layui-row layui-col-space15">
    <div class="layui-col-lg8" style="width: 100%">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-sm4" style="width: 25%">
          <div class="nepadmin-linecard">
            <p class="nepadmin-linecard-title">在线用户数量</p>
            <span class="nepadmin-linecard-text" id="userOnline_num"></span>
            <span class="nepadmin-ignore">个</span>
          </div>
        </div>
        <div class="layui-col-sm4" style="width: 25%">
          <div class="nepadmin-linecard">
            <p class="nepadmin-linecard-title">不知道放啥</p>
            <span class="nepadmin-linecard-text" id="index_today_read_times"
              >0</span
            >
            <span class="nepadmin-ignore">0</span>
          </div>
        </div>
        <div class="layui-col-sm4" style="width: 25%">
          <div class="nepadmin-linecard nepadmin-br-green">
            <p class="nepadmin-linecard-title">暂时不放叭</p>
            <span class="nepadmin-linecard-text" id="meterOnline"></span>
            <span class="nepadmin-ignore">0</span>
          </div>
        </div>
        <div class="layui-col-sm4" style="width: 25%">
          <div class="nepadmin-linecard nepadmin-br-red">
            <p class="nepadmin-linecard-title">
              当前时间
            </p>
            <div id="time"></div>
          </div>
        </div>

        <div class="layui-col-xs12" style="padding: 2px">
          <div class="layui-row layui-col-space15">
            <div class="layui-col-sm6" style="width: 100%">
              <div class="layui-card">
                <div class="layui-card-header">快捷操作</div>
                <div class="layui-card-body" style="height: 140px">
                  <div class="layui-row" style="margin-top: 15px"></div>
                </div>
              </div>
            </div>



          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
  layui.use(
    ["admin", "echarts", "element", "helper", "table", "util"],
    function (admin, echarts, element) {
      var $ = layui.jquery;
      var view = $("#VIEW-chart-index");
      element.render("progress");

      // 获取build版本
      admin.get({
        api: "getSystemVersion",
        success: function (res) {
          // console.log("获取系统版本", res);
          $("#index_sys_info").html(
            "Version: 1.0." +
              res.data.jenkinsBuildVersion +
              " | Build-Date: " +
              res.data.jenkinsBuildDate
          );
        },
      });
      layer.ready(function () {
        admin.get({
          api: "getCountUserOnlines",
          success: function (res) {
            $("#userOnline_num").html(res.data);
          },
        });
      });


      var t = null;
      t = setTimeout(showTime, 1000);

      function showTime() {
        clearTimeout(t);//清除定时器
        var date = new Date();

        // 年月日
        var year = date.getFullYear();
        var month = addZero(date.getMonth() + 1);
        var day = addZero(date.getDate());

        // 时分秒
        var hour = addZero(date.getHours());
        var minute = addZero(date.getMinutes());
        var second = addZero(date.getSeconds());

        // 实时显示
        var element = document.getElementById('time');
        element.innerHTML = '<h1>' + year + '年' + month + '月' + day + '日 ' + hour + ':' + minute + ':' + second;
        t = setTimeout(showTime, 1000); //设定定时器，循环运行
      }
      function addZero(num){
        if(num<10){
          return '0'+num;
        }else{
          return num;
        }
      }

    }
  );
</script>
